using UnityEngine;

public class HidenPakage : MonoBehaviour
{
	public HidenPakageType PakageType;

	public int PakageIndex;

	private void OnTriggerEnter(Collider other)
	{
		if ((bool)other.GetComponent<PlayerBehavior>() && other.GetComponent<PlayerBehavior>().isMine)
		{
			if (PakageIndex > 0)
			{
				CollectPakage();
				Disable();
			}
			else
			{
				BCWDebug.LogWarning("Pakage index must be greater than zero! PakageIndex = " + PakageIndex);
			}
		}
	}

	public void CollectPakage()
	{
		HidenPakageManager.instance.AddToCollectedPakages(this);
	}

	public void Disable()
	{
		base.gameObject.SetActive(false);
	}
}
